/********************************************************************************
 Project: Oscillations in Perceptual Accuracy: How well do people 
 perceive parties' ideological positions?
 Date: February 2026
 Purpose: Replication materials
 Authors: Semih Cakir Oguzhan Alkan, Ruth Dassonneville, and Zeynep Somer-Topcu
*******************************************************************************/

grstyle clear
set scheme s2color
grstyle init
grstyle set plain, box
grstyle color background white
grstyle set color gs10%50
grstyle yesno draw_major_hgrid yes
grstyle yesno draw_major_ygrid yes



	clear all
	set more off
	numlabel, add
	
	
	
/*******************************************************************************
	 Select sections to run (1 to run 0 otherwise)
*******************************************************************************/
	
	* Preparation 
	local paths				1 

	* Data coding and construction
	local prepdata1	 		0 // prepare data for analyses
	local prepdata2			0 // prepare coalition information 
	local prepdata3			0 // merge coalition data + get parlgov cabinet info 
	local prepdata4			0 // CHES data
	local prepdata5 		0 // CMP data 
	local prepdata6			0 // BES data prep
	
	* ANALYSES 
	
	local table1 			0 // Table 1: Explaining citizens' perceptions of parties' left-right positions: Main models with random intercepts and random slopes
	local figure1			0 // Figure 1: Perceptual accuracy decreases as time passes since election
	local figure2			0 // Figure 2: Perceptual accuracy increases approaching the election day and then decreases
	local figure3			0 // Figure 3: Fewer citizens can place parties on left-right as time passes after the election
	local figure4			0 // figure 4: Perceptual accuracy decreases as time passes since election for plausibly stable parties and others
	local figure5			0 // Figure 5: Party position stability over time according to CHES experts
	
	*APPENDICES 
	
	local appendixA			0 // Appendix A. Expressed Interest in Politics Declines Post-Election
	local appendixB			0 // Appendix B. Single Party Governments Days After Cabinet Formation
	local appendixC			0 // Appendix C. Don't Know Analyses
	local appendixD			0 // Appendix D. Replication using Chapel Hill Expert Survey expert perceptions
	local appendixE			0 // Appendix E. Replication MARPOR party positions
	local appendixG 		0 // Appendix G. Polities, elections and variation in timing of interview by election survey 
	local appendixH			0 // Appendix H. Randomness of time of survey-taking
	local appendixI 		0 // Appendix I. Models excluding mail-back surveys
	local appendixJ			0 // Appendix J. Replication: Estimations with socio-demographic controls
	local appendixK			0 // Appendix K. Replicating the results with a non-dyadic data structure  
	local appendixL			0 // Appendix L. Replication with country fixed effects
	local appendixM 		0 // Appendix M. Addressing the skewness and extrapolation concerns
	local appendixN			0 // Appendix N. Post-election decrease in accuracy among mainstream and niche parties
	local appendixO			0 // Appendix O. Does Partisanship Moderate the Post-Election Decline in Perceptual Accuracy?
	local appendixP 		0 // Appendix P. Models for panel data analysis - British Election Study Panel Data
	local appendixQ			0 // Appendix Q. Supply-side evidence of changing information environment
	local appendixR			0 // Appendix R. Accuracy decreases even among stable single-party governments
	local appendixS			0 // Appendix S. Stability of party positions following election day
	
	
	
/*******************************************************************************
	Set folder paths		
*******************************************************************************/

	if `paths' {
		
	*Set your directory:
	
	
	global directory "~/Dropbox/accuracy paper/Political Behavior/replication"

	
	global data "${directory}/data" // Where the datasets should be located 
	global dofiles "${directory}/dofiles" // Where the dofiles should be located 
	global tables "${directory}/tables" // Where the tables will be stored  
	global figures "${directory}/figures" // Where the figures will be stored  
	
	}

		
		/*
		You need the following files in your "data" folder:
		cses_imd.dta
		cses5.dta
		CHES_original.dta 
		CMP_original.dta
		BES2019_W23_Panel_v23.0.dta
		monthly_agendas.csv (The PartyPress Database, available on Harvard Dataverse)
		parlgov_coded.dta 
		*/
		
		/* you need the following folders:
		create a folder named "data"
		create a folder named "dofiles"
		create a folder named "figures"
		create a folder named "tables"
		create a folder named "randomness" in the folder "data"
		
		*/
		
		
/*******************************************************************************
	 Code CSES_IMD data
*******************************************************************************/

	if `prepdata1'{
		cd "${dofiles}" 
		do prep1.do 
	}
	
	
	
/*******************************************************************************
	Code coalition information
*******************************************************************************/

	if `prepdata2'{
		cd "${dofiles}" 
		do prep2.do 
	}
		
	
/*******************************************************************************
	 merge coalition data + parlgov cabinet info 
*******************************************************************************/

	if `prepdata3'{
		cd "${dofiles}" 
		do prep3.do 
	}
		
	
/*******************************************************************************
	 CHES data
*******************************************************************************/

	if `prepdata4'{
		cd "${dofiles}" 
		do prep4.do 
	}
		
	
/*******************************************************************************
	 MARPOR (CMP) data
*******************************************************************************/

	if `prepdata5'{
		cd "${dofiles}" 
		do prep5.do 
	}
		

/*******************************************************************************
	 BES DATA PREP
*******************************************************************************/

	if `prepdata6'{
		cd "${dofiles}" 
		do prep6.do 
	}
		
	
		
		*****************
		*	MAIN TEXT 	*
		*****************
	
	
	
/*******************************************************************************
	 TABLE 1 - Explaining Citizens' Perceptions of Parties' Left-Right Positions: Main models with random intercepts and random slopes
*******************************************************************************/

	if `table1'{
		cd "${dofiles}" 
		do table1.do 
	}		
		
				
				
/*******************************************************************************
	 FIGURE 1 - Perceptual Accuracy Decreases as Time Passes Since Election
*******************************************************************************/

	if `figure1'{
		cd "${dofiles}" 
		do figure1.do 
	}		
		
		
/*******************************************************************************
	 FIGURE 2 - Perceptual Accuracy Increases Approaching the Election Day and Then Decreases
*******************************************************************************/

	if `figure2'{
		cd "${dofiles}" 
		do figure2.do 
	}		
		

/*******************************************************************************
	 FIGURE 3 - Fewer Citizens Can Place Parties on Left-Right as Time Passes after the Election
*******************************************************************************/

	if `figure3'{
		cd "${dofiles}" 
		do figure3.do 
	}		
		
		
/*******************************************************************************
	 FIGURE 4 - Fit between citizens' and experts' perceptions of parties as time since the election increases for plausibly stable parties and others
*******************************************************************************/

	if `figure4'{
		cd "${dofiles}" 
		do figure4.do 
	}		
		
	
	
/*******************************************************************************
	 FIGURE 5 - Party Position Stability Over Time according to CHES Experts
*******************************************************************************/

	if `figure5'{
		cd "${dofiles}" 
		do figure5.do 
	}		
			
	
	
	
	
	
		*****************
		*	APPENDICES 	*
		*****************
	
	
	
/*******************************************************************************
	 APPENDIX A - Expressed Interest in Politics Declines Post-Election
*******************************************************************************/

	if `appendixA'{
		cd "${dofiles}" 
		do appendixA.do 
	}		
		
	
/*******************************************************************************
	 APPENDIX B - Single Party Governments Days After Cabinet Formation
*******************************************************************************/

	if `appendixB'{
		cd "${dofiles}" 
		do appendixB.do 
	}			

	
/*******************************************************************************
	 APPENDIX C - Don't Know Analyses
*******************************************************************************/

	if `appendixC'{
		cd "${dofiles}" 
		do appendixC.do 
	}			
	

		
/*******************************************************************************
	 APPENDIX D - Replication using Chapel Hill Expert Survey expert perceptions
*******************************************************************************/

	if `appendixD'{
		cd "${dofiles}" 
		do appendixD.do 
	}		
	
	
		
/*******************************************************************************
	 APPENDIX E - Replication MARPOR party positions
*******************************************************************************/

	if `appendixE'{
		cd "${dofiles}" 
		do appendixE.do 
	}		
	

/*******************************************************************************
	 APPENDIX G - Polities, elections and variation in timing of interview by election survey 
*******************************************************************************/

	if `appendixG'{
		cd "${dofiles}" 
		do appendixG.do 
	}		
	
	
/*******************************************************************************
	 APPENDIX H - Randomness of time of survey-taking
*******************************************************************************/

	if `appendixH'{
		cd "${dofiles}" 
		do appendixH.do 
	}			

	
	
/*******************************************************************************
	 APPENDIX I - Models excluding mail-back surveys
*******************************************************************************/

	if `appendixI'{
		cd "${dofiles}" 
		do appendixI.do 
	}			
		
	
/*******************************************************************************
	 APPENDIX J - Replication: Estimations with socio-demographic controls
*******************************************************************************/

	if `appendixJ'{
		cd "${dofiles}" 
		do appendixJ.do 
	}			
			
/*******************************************************************************
	 APPENDIX K - Replicating the results with a non-dyadic data 
*******************************************************************************/

	if `appendixK'{
		cd "${dofiles}" 
		do appendixK.do 
	}			
			
/*******************************************************************************
	 APPENDIX L - Replication with country fixed effects
*******************************************************************************/

	if `appendixL'{
		cd "${dofiles}" 
		do appendixL.do 
	}			
					
			
/*******************************************************************************
	 APPENDIX M - Addressing the skewness and extrapolation concerns
*******************************************************************************/

	if `appendixM'{
		cd "${dofiles}" 
		do appendixM.do 
	}			
	
	
/*******************************************************************************
	 APPENDIX N - Post-election decrease in accuracy among mainstream and niche parties
*******************************************************************************/

	if `appendixN'{
		cd "${dofiles}" 
		do appendixN.do 
	}			
	
	
/*******************************************************************************
	 APPENDIX O - Does Partisanship Moderate the Post-Election Decline in Perceptual Accuracy?
*******************************************************************************/

	if `appendixO'{
		cd "${dofiles}" 
		do appendixO.do 
	}			
	
/*******************************************************************************
	 APPENDIX P - Models for panel data analysis - British Election Study Panel Data
*******************************************************************************/

	if `appendixP'{
		cd "${dofiles}" 
		do appendixP.do 
	}			
			
	
/*******************************************************************************
	 APPENDIX Q - Supply-side evidence of changing information environment
*******************************************************************************/

	if `appendixQ'{
		cd "${dofiles}" 
		do appendixQ.do 
	}			
			
	
/*******************************************************************************
	 APPENDIX R - Accuracy decreases even among stable single-party governments
*******************************************************************************/

	if `appendixR'{
		cd "${dofiles}" 
		do appendixR.do 
	}		
	
/*******************************************************************************
	 APPENDIX S - Stability of party positions following election day
*******************************************************************************/

	if `appendixS'{
		cd "${dofiles}" 
		do appendixS.do 
	}		
	
	
	